# -*- coding:utf-8 -*-

from fastapi import APIRouter, Depends, HTTPException, status, HTTPException
from fastapi.responses import JSONResponse

from services.auth import password_hash, auth_login, auth_refresh_token, Token

router = APIRouter(prefix="/auth")

@router.get("/password", response_model=str, summary="密码测试")
async def password_test(password:str):
    return password_hash(password)

@router.post("/login", response_model=Token, summary="登录")
async def login(token: Token = Depends(auth_login)):
    return token

@router.get("/refresh", response_model=Token, summary="token 刷新")
async def refresh_token(token: Token = Depends(auth_refresh_token)):
    return token

